<script>
import {defineComponent} from 'vue'

export default defineComponent({
    name: "directiveView",
    data() {
        return {
            text: '自定义指令',
            colorText: 'green',
            textT: ''
        }
    },
    // 私有定义指令
    directives: {
        bind (el, bindIng) {
            el.style.color = bindIng.value
            console.log(bindIng.value)
        },
        inserted(el) {
            console.log(el)
        },
        update (el) {
            console.log(el+'更新')
        }
    }
})
</script>

<template>
  <div>
      <p v-color>{{text}}</p>
      <input type="text" v-color="colorText" v-model="textT">
  </div>
</template>

<style scoped lang="less">

</style>